home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kresources / managerimpl.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  2.9 KB  |  108 lines

  1. /*
  2.     This file is part of libkresources.
  3.  
  4.     Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
  5.     Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
  6.     Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
  7.  
  8.     This library is free software; you can redistribute it and/or
  9.     modify it under the terms of the GNU Library General Public
  10.     License as published by the Free Software Foundation; either
  11.     version 2 of the License, or (at your option) any later version.
  12.  
  13.     This library is distributed in the hope that it will be useful,
  14.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16.     Library General Public License for more details.
  17.  
  18.     You should have received a copy of the GNU Library General Public License
  19.     along with this library; see the file COPYING.LIB.  If not, write to
  20.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  21.     Boston, MA 02110-1301, USA.
  22. */
  23. #ifndef KRESOURCES_MANAGERIMPL_H
  24. #define KRESOURCES_MANAGERIMPL_H
  25.  
  26. #include <qstring.h>
  27. #include <qptrlist.h>
  28. #include <qdict.h>
  29.  
  30. #include "manageriface.h"
  31. #include <kresources/resource.h>
  32.  
  33. class KConfig;
  34.  
  35. namespace KRES {
  36.  
  37. class Resource;
  38. class Factory;
  39. class ManagerNotifier;
  40.  
  41. /**
  42.   @internal
  43.  
  44.   Do not use this class directly. Use ResourceManager instead
  45. */
  46. class KRESOURCES_EXPORT ManagerImpl : virtual public ManagerIface
  47. {
  48.   public:
  49.     ManagerImpl( ManagerNotifier *, const QString &family );
  50.     ~ManagerImpl();
  51.  
  52.     void readConfig( KConfig * );
  53.     void writeConfig( KConfig * );
  54.  
  55.     void add( Resource *resource );
  56.     void remove( Resource *resource );
  57.     void change( Resource *resource );
  58.  
  59.     Resource *standardResource();
  60.     void setStandardResource( Resource *resource );
  61.  
  62.     void setActive( Resource *resource, bool active );
  63.  
  64.     Resource::List *resourceList();
  65.  
  66.     QPtrList<Resource> resources();
  67.  
  68.     // Get only active or passive resources
  69.     QPtrList<Resource> resources( bool active );
  70.  
  71.     QStringList resourceNames();
  72.  
  73.     static QString defaultConfigFile( const QString &family );
  74.  
  75.   private:
  76.     // dcop calls
  77.     void dcopKResourceAdded( QString managerId, QString resourceId );
  78.     void dcopKResourceModified( QString managerId, QString resourceId );
  79.     void dcopKResourceDeleted( QString managerId, QString resourceId );
  80.  
  81.   private:
  82.     void createStandardConfig();
  83.  
  84.     Resource *readResourceConfig( const QString& identifier, bool checkActive );
  85.     void writeResourceConfig( Resource *resource, bool checkActive );
  86.  
  87.     void removeResource( Resource *resource );
  88.     Resource *getResource( Resource *resource );
  89.     Resource *getResource( const QString& identifier );
  90.  
  91.     ManagerNotifier *mNotifier;
  92.     QString mFamily;
  93.     KConfig *mConfig;
  94.     KConfig *mStdConfig;
  95.     Resource *mStandard;
  96.     Factory *mFactory;
  97.     Resource::List mResources;
  98.     QString mId;
  99.     bool mConfigRead;
  100.  
  101.     class ManagerImplPrivate;
  102.     ManagerImplPrivate *d;
  103. };
  104.  
  105. }
  106.  
  107. #endif
  108.